import React, { Component } from 'react';
import  '../../style/Index/Header.css'
import  hg from '../../assets/hg.png'
import { withRouter } from 'react-router-dom';
interface Props{
    history:any,match:any,location:any
}
class Header extends Component<Props> {

    onClick(){
        this.props.history.push('/search')
    }
    handleclick(){
        this.props.history.push('/login')
    }
    onClickcity(){
        this.props.history.push('/city')
    }
    render() {
        return (
            <div className='header'>
                <span onClick={()=>{this.onClickcity()}} >{this.props.location.state==undefined?'西安':this.props.location.state.city}</span>
               <img src={hg} alt="" />
                <input type="text" placeholder='立柜式空调' onClick={()=>{this.onClick()}}/>
                <span onClick={()=>{this.handleclick()}} >登录</span>
            </div>
        );
    }
}

export default withRouter(Header);